package com.zpark;

import java.util.Scanner;

public class Boxes {
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int a,b,c,d,e,f;
        System.out.println("请输入1X1的产品数量");
        a = scan.nextInt();
        System.out.println("请输入2X2的产品数量");
        b = scan.nextInt();
        System.out.println("请输入3X3的产品数量");
        c = scan.nextInt();
        System.out.println("请输入4X4的产品数量");
        d = scan.nextInt();
        System.out.println("请输入5X5的产品数量");
        e = scan.nextInt();
        System.out.println("请输入6X6的产品数量");
        f = scan.nextInt();
        int result=calc(a, b, c, d, e, f);

    }
    private static int calc(int a,int b,int c,int d,int e,int f){
        int n,x,y;
        int[] space={0,5,3,1};
        n=f+e+d+(c+3)/4;
        y=5*d+space[c%4];
        if (b > y)
            n+=(b-y+8)/9;
        x=36*n-36*f-25*e-16*d-9*c-4*b;
        if(a>x)
            n+=(a-x+35)/36;
        return n;
    }
}
